#include <stdio.h>
#include <string.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>


int main()
{
	int fd = open("log.txt",O_CREAT | O_WRONLY | O_TRUNC,0666);

	dup2(fd,1);
	write(1,"hello 1\n",9);

	printf("hello fd: %d\n",fd);
	fprintf(stdout,"hello fd: %d\n",fd);
	fputs("hello world\n",stdout);

	const char* message = "hello fwrite\n";
	fwrite(message,1,strlen(message),stdout);
	return 0;
}
